<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">商品分类 - <?= $shop_name?></div>
                </div>
                <div class="widget-body am-fr">
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <a class="am-btn am-btn-default am-btn-success am-radius"
                                       href="{:url('food.goods.category/add',['shop_id' => $shop_id])}">
                                        <span class="am-icon-plus"></span> 新增
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                            <tr>
                                <th>分类ID</th>
                                <th>分类名称</th>
                                <th>分类排序</th>
                                <th>添加时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {if !empty($list)}
                                {foreach $list as $first}
                                <tr>
                                    <td class="am-text-middle">{$first['category_id']}</td>
                                    <td class="am-text-middle">{$first['name']}</td>
                                    <td class="am-text-middle">{$first['sort']}</td>
                                    <td class="am-text-middle">{$first['create_time']}</td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="{:url('food.goods.category/edit',['id' => $first['category_id'],'shop_id' => $shop_id])}">
                                                <i class="am-icon-pencil"></i> 编辑
                                            </a>
                                            <a href="javascript:;" class="item-del tpl-table-black-operation-del"
                                               data-ids="{$first['category_id']}">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                {if isset($first['child'])}
                                    {foreach $first['child'] as $two}
                                    <tr>
                                        <td class="am-text-middle">{$two['category_id']}</td>
                                        <td class="am-text-middle">　--  {$two['name']}</td>
                                        <td class="am-text-middle">{$two['sort']}</td>
                                        <td class="am-text-middle">{$two['create_time']}</td>
                                        <td class="am-text-middle">
                                            <div class="tpl-table-black-operation">
                                                <a href="{:url('food.goods.category/edit',['id' => $two['category_id'],'shop_id' => $shop_id])}">
                                                    <i class="am-icon-pencil"></i> 编辑
                                                </a>
                                                <a href="javascript:;" class="item-del tpl-table-black-operation-del"
                                                   data-ids="{$two['category_id']}">
                                                    <i class="am-icon-trash"></i> 删除
                                                </a>
                                            </div>
                                        </td>
                                    </tr>
                                    {if isset($two['child'])}
                                        {foreach $two['child'] as $three}
                                        <tr>
                                            <td class="am-text-middle">{$three['category_id']}</td>
                                            <td class="am-text-middle">　　　-- {$three['name']}</td>
                                            <td class="am-text-middle">{$three['create_time']}</td>
                                            <td class="am-text-middle">
                                                <div class="tpl-table-black-operation">
                                                    <a href="{:url('food.goods.category/edit',['id' => $three['category_id'],'shop_id' => $shop_id])}">
                                                        <i class="am-icon-pencil"></i> 编辑
                                                    </a>
                                                    <a href="javascript:;" class="item-del tpl-table-black-operation-del"
                                                       data-ids="{$three['category_id']}">
                                                        <i class="am-icon-trash"></i> 删除
                                                    </a>
                                                </div>
                                            </td>
                                        </tr>
                                        {/foreach}
                                    {/if}
                                    {/foreach}
                                {/if}
                                {/foreach}
                            {else /}
                                <tr>
                                    <td colspan="5" class="am-text-center">暂无记录</td>
                                </tr>
                            {/if}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        // 删除元素
        var url = "{:url('food.goods.category/delete')}";
        $('.item-del').del('id', url);

    });
</script>

